package cn.jhc.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jhc.bean.PubliShers;
import cn.jhc.bean.Publisher;
import cn.jhc.dao.DaoType;
import cn.jhc.dao.PublisherDAO;
import cn.jhc.factory.DAOFactory;

/**
 * Servlet implementation class ShowpublisherServlet
 */
@WebServlet("/showpublisher.htm")
public class ShowpublisherServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		List<Publisher> publisherlist = new ArrayList();
		PublisherDAO pdao = (PublisherDAO)DAOFactory.getDao(DaoType.PUBLISHER);
		publisherlist = pdao.getAll();
		request.setAttribute("publisherlist", publisherlist);
		request.getRequestDispatcher("/admin/admin.jsp?body=/tiles/showPublisher.jsp").forward(request, response);
	}

}
